package com.huluobo.high3demo.home.items;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.high3demo.R;
import com.huluobo.mvvm.baen.GoodsBeanResult;
import com.huluobo.mvvm.utils.ImageLoader;

import java.util.List;

/**
 * Created by LC on 2023/9/18.
 */
public class ItemAdapter extends BaseQuickAdapter<GoodsBeanResult.GoodsBean, BaseViewHolder> {
    public ItemAdapter(@Nullable List<GoodsBeanResult.GoodsBean> data) {
        super(R.layout.item_goods_layout, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GoodsBeanResult.GoodsBean goodsBean) {
        baseViewHolder.setText(R.id.item_goods_tv, goodsBean.getGoods_desc());
        baseViewHolder.setText(R.id.item_goods_price, goodsBean.getGoods_default_price()+"元");

        ImageView imageView = baseViewHolder.findView(R.id.item_goods_iv);
        ImageLoader.getInstance().loadImage(getContext(), goodsBean.getGoods_default_icon(), imageView);
    }
}
